/*
 * @Author: zhang zhijiang 2824735304@qq.com
 * @Date: 2025-03-20 19:46:11
 * @LastEditors: zhang zhijiang 2824735304@qq.com
 * @LastEditTime: 2025-03-20 20:10:19
 * @FilePath: /linux/test_3_20/mythread.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include<iostream>
#include<vector>
#include<cstring>
#include<unistd.h>
#include<pthread.h>
using namespace std;
//多线程的实现
class td
{
    public:
    td(const string & tdname)
    :_tdname(tdname)
    {}
    public:
    string _tdname;
    
};
void* rountine (void *argvs)
{
    td* tdata = static_cast<td*>(argvs); 
   
    cout<<"name:"<<tdata->_tdname<<"id:" <<pthread_self()<<endl;
    return nullptr;
}
int main()
{
    vector<td> tdatas;
    for(int i = 0;i<100;i++)
    {
        pthread_t tid;
        string tname = "thread-" + to_string(i);
        td tdata(tname);
        tdatas.push_back(tdata);
        pthread_create(&tid,nullptr,rountine,&tdatas[i]);
    }
    for(int i = 0;i<100;i++)
    {
        
    }
    return 0;
}